package com.xigua._排序;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2022/3/2715:12
 */
public class _189_轮转数组 {


    public static void main(String[] args) {

    }

    public void rotate(int[] nums, int k) {
        int length = nums.length;
        int[] newNums = new int[length];
        for (int i = 0; i < length; i++) {
            newNums[(i+k)%length] = nums[i];
        }
        System.arraycopy(newNums,0,nums,0,length);
    }

}
